package com.sc.nft.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sc.nft.entity.CollecionLinkContrastRecords;
import com.sc.nft.entity.UserInfo;
import com.sc.nft.entity.vo.metaWalletDTO.AdminLinkCollectionPageVO;
import com.sc.nft.entity.vo.metaWalletDTO.MetaWalletCrossUserVO;
import com.sc.nft.entity.vo.metaWalletDTO.OfferToMetaCollectionPageDTO;
import com.sc.nft.entity.vo.metaWalletDTO.ToMetaCollectionPageDTO;
import com.sc.nft.entity.vo.metaWalletDTO.request.NotLinkCollectionPageRequest;
import com.sc.nft.sup.MetaPage;
import com.sc.nft.sup.PageResult;

import java.util.List;

public interface MetaWalletService {

    /**
     * 获取未关联的藏品集合(钱包藏品)
     * @param request
     * @return
     * @throws IllegalAccessException
     */
    PageResult<OfferToMetaCollectionPageDTO> getNotLinkCollectionPage(NotLinkCollectionPageRequest request) throws IllegalAccessException;

    /**
     * 关联外部藏品对照表
     * @param collecionLinkContrastRecords
     */
    void linkCollection(CollecionLinkContrastRecords collecionLinkContrastRecords);

    /**
     * 查询藏品关联信息
     * @param collectionId
     * @return
     */
    CollecionLinkContrastRecords getLinkCollectionInfo(Long collectionId);

    /**
     * 关联对照表
     * @param page
     * @return
     */
    Page<AdminLinkCollectionPageVO> getLinkCollectionPage(String collectionName,String linkCollectionName,Page page);

    /**
     * 检查用户地址
     * @param userAddr
     * @return
     */
    MetaWalletCrossUserVO checkUeerArrd(String userAddr) throws IllegalAccessException;

    /**
     * 校验藏品是否可以转增
     * @param numberList
     * @return
     */
    Boolean checkCollectionNumerber(UserInfo user, Long collectionId, List<Integer> numberList,String toUserAddr) throws IllegalAccessException;

    /**
     * 通知钱包执行转增
     * @param userCollectionChainLogId
     */
    void transferToMetaWallet(Long userCollectionChainLogId) throws IllegalAccessException;

    /**
     * 接收钱包的转增
     * @param collectionId
     * @param tokenId
     * @param toUserAddress
     * @param fromUserAddress
     */
    void transferCollectonFromMetaWallet(Long collectionId, Integer tokenId, String toUserAddress, String fromUserAddress,String fromUserNickName);

    /**
     * 校验用户地址是否存在
     * @param userAddr
     */
    MetaWalletCrossUserVO checkUserAddrIsExist(String userAddr) throws IllegalAccessException;

    /**
     * 校验藏品是否是可以交易状态
     * @param collectionId
     * @param tokenIds
     */
    void checkCollecton(Long collectionId, List<Integer> tokenIds);

    /**
     * 给钱包提供未关联的藏品
     * @param daoName
     * @param collectioName
     * @param page
     * @return
     */
    Page<ToMetaCollectionPageDTO> toWalletNotLinkCollectionPage(String daoName, String collectioName, Page page);
}
